﻿<%@ page contentType="text/html; charset=utf-8"%>
<%@ page import="cn.ac.cintcm.dataconverge.researcher.domain.Researcher" %>
<%@ page import="cn.ac.cintcm.dataconverge.util.Constants" %>
<%@ include file="/WEB-INF/jsp/taglib.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>科研项目管理与数据汇交平台</title>
<link href="css/style1.css" rel="stylesheet" type="text/css" media="all" />
</head>
<script language="javascript">
window.onload=function focus()
{
    <%Researcher user=(Researcher) request.getSession().getAttribute(Constants.USER_IN_SESSION); 
     if(user!=null)  {
      %>
      window.parent.middle.location.href="subject.htm?action=listMySubjects";
    <%}else{%>    
      window.parent.middle.location.href="subjectSearch.htm";
    <%}%>
    if('${flag}'=='register'){
      window.parent.middle.location.href="researcher.htm?action=registerFirst";
      alert("系统中还有其他用户和您重名，请设置属于你自己的ID");
      }
    if('${alert}'!=''){
    alert('${alert}');
    document.mainfm.name.focus();
    }
}
	function hover(obj){
		obj.className = obj.className + "-hover";
	}

	function hout(obj){
		obj.className = obj.className.replace("-hover","");
	}
	
	function changeClass(obj){
		var parentObj=obj.parentNode;
		var siblings=parentObj.parentNode.childNodes;
		if(siblings.length>0){
			for(var i=0;i<siblings.length;i++)
			{
				siblings[i].className="menu-li";
			}
		}
		parentObj.className="menu-li-hover";
	}
	
	function check(){
	var fm=document.forms[0];
	if(fm.name.value==""){
	alert("请输入用户名!");
	fm.name.focus();
	return false;
	}
	if(fm.password.value==""){
	alert("请输入密码!");
    fm.password.focus();
    return false;
    }
    return true;
    }
    function logout(){
    url = "login.htm?action=logout";
	document.location.href = url;
    }
    function regInfoMod(){
    url = "researcher.htm?action=regInfoMod&flag=regInfoMod";
	document.location.href = url;
    }
    function login(){
    if(check()){
    var name=document.all.name.value;
    var password=document.all.password.value;
    url = "login.htm?action=login&name="+name+"&password="+password;
	document.location.href = url;
    }
    }
    function register(){
     window.parent.middle.location.href="researcher.htm?action=registerFirst";
    }

	function comments(){
	  window.parent.middle.location.href="comments.htm";
	}
    function searcherSubject(param){ 
     if( param==1 || param==0 && event.keyCode==13){
     	 var searchContent=document.getElementById("subjectName").value; 
    	 window.parent.middle.location.href="subject.htm?action=overallSearch&searchContent="+escape(searchContent);
     }
     //document.frames("middle").document.form0.subjectName.value=document.mainfm.subjectName.value;
    // document.frames("middle").document.form0.submit();
    }
    function login(){
    document.mainfm.action="login.htm?action=login";
    document.mainfm.submit();
    }
	</script>
</head>

<body>
<table width="100%"  border="0" cellspacing="4">
  <tr>
    <td width="223" height="58" rowspan="3"><img src="images/logo.png" width="223" height="58"></td>
    <td colspan="4"><div align="right">课题名称</div></td>
    <td colspan="2">      <input type="text" id="subjectName"  onkeydown="searcherSubject(0);">
    <input type="submit" name="Submit" value="搜索" onclick="searcherSubject(1);"></td>
  </tr>
  <tr>
    <td colspan="3" align="center" bgcolor="#CCFFCC"><a href="subjectSearch.htm"  target="middle" >科研课题</a> </td>
    <td align="center" bgcolor="#CCFFCC"><a href="subjectAnalyze.htm"  target="middle" >科研统计</a></td>
    <td align="center" bgcolor="#CCFFCC"><a href="system.htm"  target="middle" >系统管理</a></td>
    <td align="center" bgcolor="#CCFFCC"><a href="comments.htm"  target="middle" >留言</a></td>
  </tr>
    <form name="mainfm" method="post" action="login.htm?action=login" onsubmit="return check();">   
    <c:choose>    
    <c:when test="${username==null||username==''}">

		  <tr>
			<td width="41">帐号</td>
			<td width="168"><input type="text" name="name"></td>
			<td width="40">密码</td>
			<td width="168"><input type="password" name="password" maxlength="25" ></td>
			<td width="209"><input type="submit" name="Submit2" value="登录">&nbsp;&nbsp;&nbsp;
			<a href="researcher.htm?action=registerFirst"  target="middle">注册</a></td>
			<td width="94" align="center"><a href="help.html">帮助</a></td>
		  </tr>
    </c:when>
    <c:otherwise>
		  <tr>
			<td width="41">&nbsp;</td>
			<td width="168">${username},您好!</td>
			<td width="40">&nbsp;</td>
			<td width="168"><a href="researcher.htm?action=regInfoMod&flag=regInfoMod"  target="middle" >修改个人资料</a></td>
			<td width="209"><a href="login.htm?action=logout"   onclick="logout();" >退出系统</a></td>
			<td width="94">&nbsp;</td>
		  </tr>
    </c:otherwise>
    </c:choose>   
   </form> 
</table>
 
<div id="content"><iframe src="" name="middle" width="100%"  height="500"  frameborder="0" > </iframe></div>


</body>
</html>
